package exsun.jt808.data.distribute_data.jt1078;

import com.alibaba.fastjson.JSONObject;
import exsun.jt808.data.distribute_data.DistributeEntity;
import lombok.Data;

import java.io.Serializable;
import java.text.SimpleDateFormat;

/**
 * 实时音视频传输请求
 */
@Data
public class RealtimeMediaUploadReq extends DistributeEntity implements Serializable {
    /**
     * 实时视频服务器IP地址
     */
    public String ip;
    /**
     * 实时视频服务器TCP端口
     */
    public int tcpPort;
    /**
     * 实时视频服务器UDP端口
     */
    public int udpPort;
    /**
     * 逻辑通道号
     */
    public int chanelId;
    /**
     * 数据类型
     * 0音视频 1视频 2双向对讲 3监听 4中心广播 5透传
     */
    public int mediaType;
    /**
     * 码流类型 0主码流 1子码流
     */
    public int codeType;

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getTcpPort() {
        return tcpPort;
    }

    public void setTcpPort(int tcpPort) {
        this.tcpPort = tcpPort;
    }

    public int getUdpPort() {
        return udpPort;
    }

    public void setUdpPort(int udpPort) {
        this.udpPort = udpPort;
    }

    public int getChanelId() {
        return chanelId;
    }

    public void setChanelId(int chanelId) {
        this.chanelId = chanelId;
    }

    public int getMediaType() {
        return mediaType;
    }

    public void setMediaType(int mediaType) {
        this.mediaType = mediaType;
    }

    public int getCodeType() {
        return codeType;
    }

    public void setCodeType(int codeType) {
        this.codeType = codeType;
    }

    public JSONObject toJSONString() {
        JSONObject object = new JSONObject();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        object.put("ip", ip);
        object.put("tcpPort", tcpPort);
        object.put("udpPort", udpPort);
        object.put("chanelId", chanelId);
        object.put("mediaType", mediaType);
        object.put("codeType", codeType);
        object.put("distributeMsgTopic", distributeMsgTopic);
        object.put("msgId", msgId);
        object.put("devNo", devNo);
        object.put("requestId", requestId);
        object.put("userId", userId);
        object.put("userName", userName);
        object.put("distributeTime", sdf.format(distributeTime));
        object.put("serialNo", serialNo);
        object.put("response", response);
        return object;
    }
}
